1 | sudo cat hosts.patch > /etc/hosts |
系统提示Permission Denied
因为该命令会分成两步执行:1
sudo cat hosts.patch #有sudo
1 | > /etc/hosts #并没有sudo权限 |
解决:1
2
3
4
5sudo sh -c "cat hosts.patch > /etc/hosts"
# 或者:
echo "cat hosts.patch > /etc/hosts" | sudo sh
1 | sudo cat hosts.patch > /etc/hosts |
系统提示Permission Denied
因为该命令会分成两步执行:1
sudo cat hosts.patch #有sudo
1 | > /etc/hosts #并没有sudo权限 |
解决:1
2
3
4
5sudo sh -c "cat hosts.patch > /etc/hosts"
# 或者:
echo "cat hosts.patch > /etc/hosts" | sudo sh
微信打赏
支付宝打赏